home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2510.ZIP
/
TRSOURCE.EXE
/
LOGTEN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-22
|
730b
|
37 lines
/*********
*
* LOGTEN.C
*
* by Ralph Davis
*
* Placed in the public domain by Tom Rettig Associates, 10/22/1990.
*
* Syntax: LOGTEN( <expN> )
* Return: Log of <expN> to the base 10 if <expN> >= 0
INFINITY() if <expN> < 0.
*********/
#include "trlib.h"
TRTYPE logten()
{
double n, ret;
if ( PCOUNT == 1 && ISNUM(1) )
{
n = _parnd(1);
if (n < 0) /* Number cannot be negative */
_retnd(_tr_infinity());
else
{
/* Log of n to the base 10 = Log(n) divided by Log(10) */
ret = _tr_log(n) / _tr_log(10.0);
_retnd( ret );
}
}
else
_retnd(ERROR); /* ZERO value if error */
}